package com.lyf.core.pojo;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class Department {
	 
		private Integer did		;//serial  not null primary key,
		private Integer p_id		;//int not null, --上一层 0 表示顶层
		private String department_name		;//text not null, -- 机构名称
//		private Integer department_type		;//int2   -- 机构类型 1-普通机构 2-项目组,项目组不允许有下级机构
		private String create_uid ; // 创建者用户ID
		private String leader_name ;//	varchar(50) , -- 负责人姓名
		private String leader_tel	 ;//varchar(50)  -- 负责人电话
		private Date crtime ;
		private Date last_modify_time ;
		private String description ;
		
		//冗余
		private String state ;
		private String parent_name;
		private List<Department> children ;
		
		 public void addChild(Department dept){
			 if(children == null)
				 children = new ArrayList<>();
			 
			 children.add(dept);
		 }

		public Integer getDid() {
			return did;
		}


		public void setDid(Integer did) {
			this.did = did;
		}


		public Integer getP_id() {
			return p_id;
		}


		public void setP_id(Integer p_id) {
			this.p_id = p_id;
		}


		public String getDepartment_name() {
			return department_name;
		}


		public void setDepartment_name(String department_name) {
			this.department_name = department_name;
		}

		
		 

		public String getCreate_uid() {
			return create_uid;
		}

		public void setCreate_uid(String create_uid) {
			this.create_uid = create_uid;
		}

		 

		public String getLeader_name() {
			return leader_name;
		}


		public void setLeader_name(String leader_name) {
			this.leader_name = leader_name;
		}


		public String getLeader_tel() {
			return leader_tel;
		}


		public void setLeader_tel(String leader_tel) {
			this.leader_tel = leader_tel;
		}


		public String getState() {
			return state;
		}


		public void setState(String state) {
			this.state = state;
		}


		public String getDescription() {
			return description;
		}


		public void setDescription(String description) {
			this.description = description;
		}

		

		public Date getCrtime() {
			return crtime;
		}

		public void setCrtime(Date crtime) {
			this.crtime = crtime;
		}

		public Date getLast_modify_time() {
			return last_modify_time;
		}

		public void setLast_modify_time(Date last_modify_time) {
			this.last_modify_time = last_modify_time;
		}

		public String getParent_name() {
			return parent_name;
		}


		public void setParent_name(String parent_name) {
			this.parent_name = parent_name;
		}
		 
		
		public List<Department> getChildren() {
			return children;
		}


		public void setChildren(List<Department> children) {
			this.children = children;
		}


		@Override
		public int hashCode() {
			// TODO Auto-generated method stub
			return getDid();
		}
		
		@Override
		public boolean equals(Object obj) {
			if(obj instanceof Department) {
				Department d = (Department)obj;
				if(d.getDid().equals(getDid())  ){
					return true ;
				}
			}
			return super.equals(obj);
		}
		 
}
